<?php

class DBMGeneralTranslator implements DBMTranslator {
	
	public static function translateToMySQL($translatable, $command = null) {
		if(is_object($translatable)){
			if($translatable instanceof DBMEntity){
				return DBMEntityTranslator::translateToMySQL($translatable, $command);
			} elseif($translatable instanceof DBMAttribute){
				return DBMAttributeTranslator::translateToMySQL($translatable, $command);
			} elseif($translatable instanceof DBMLogicalFilter){
				return DBMLogicalFilterTranslator::translateToMySQL($translatable, $command);
			} elseif($translatable instanceof DBMInFilter){
				return DBMInFilterTranslator::translateToMySQL($translatable, $command);
			} else{
				return DBMObjectTranslator::translateToMySQL($translatable, $command);
			}
		} else {
			return DBMPrimitiveTranslator::translateToMySQL($translatable, $command);
		}
	}
	
	public static function translateToPostgreSQL($translatable, $command = null) {
		if(is_object($translatable)){
			if($translatable instanceof DBMEntity){
				return DBMEntityTranslator::translateToPostgreSQL($translatable, $command);
			} elseif($translatable instanceof DBMAttribute){
				return DBMAttributeTranslator::translateToPostgreSQL($translatable, $command);
			} elseif($translatable instanceof DBMLogicalFilter){
				return DBMLogicalFilterTranslator::translateToPostgreSQL($translatable, $command);
			} elseif($translatable instanceof DBMInFilter){
				return DBMInFilterTranslator::translateToPostgreSQL($translatable, $command);
			} else{
				return DBMObjectTranslator::translateToPostgreSQL($translatable, $command);
			}
		} else {
			return DBMPrimitiveTranslator::translateToPostgreSQL($translatable, $command);
		}
	}
	
	public static function translateToSQLServer($translatable, $command = null) {
		if(is_object($translatable)){
			if($translatable instanceof DBMEntity){
				return DBMEntityTranslator::translateToSQLServer($translatable, $command);
			} elseif($translatable instanceof DBMAttribute){
				return DBMAttributeTranslator::translateToSQLServer($translatable, $command);
			} elseif($translatable instanceof DBMLogicalFilter){
				return DBMLogicalFilterTranslator::translateToSQLServer($translatable, $command);
			} elseif($translatable instanceof DBMInFilter){
				return DBMInFilterTranslator::translateToSQLServer($translatable, $command);
			} else{
				return DBMObjectTranslator::translateToSQLServer($translatable, $command);
			}
		} else {
			return DBMPrimitiveTranslator::translateToSQLServer($translatable, $command);
		}
	}
}

?>
